{extend name="./public/base"/}
{block name="alt"}admin上传视频列表管理{/block}
{block name="alter"}admin上传视频列表{/block}
{block name="title"}BangBang管理员上传视频列表{/block}
{block name="tan"}
    <button class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">添加新视频</button>
    <br>
    <br>
    <!-- 模态框（Modal） -->
               <!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">添加新视频</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" action="{:url('addvideo')}" method="post" enctype="multipart/form-data">
<div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">视频名称</label>
    <div class="col-sm-10">
      <input type="text" name="videoname" class="form-control" id="inputPassword" required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">视频类型</label>
    <div class="col-sm-10">
       <select class="form-control" name="tid">
         {volist name="types" id="type"}
      <option  value="{$type.tid}">{$type.typename}</option>
      {/volist}
    </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">视频所属体系</label>
    <div class="col-sm-10">
       <select class="form-control" name="know" id="know" style="width: 11rem;" required> 
                    <option value="">知识体系</option>
                    {volist name="knows" id="kn"}
                    <option value="{$kn.kid}">{$kn.kname}</option>
                    {/volist}                           
                  </select>

          <select class="form-control" name="kbid" id="kboy" style="width: 11rem;" required>  
                    <option value="">子知识体系</option>  
                  </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">职业方向</label>
    <div class="col-sm-10">
       <select class="form-control" name="oid" style="width: 11rem;" required> 
                    
                    {volist name="occus" id="oc"}
                    <option value="{$oc.oid}">{$oc.oname}</option>
                    {/volist}                           
                  </select>

          <select class="form-control" name="olevel"  style="width: 11rem;" required>  
                   
                    <option value="1">入门</option>
                    <option value="2">基础</option>
                    <option value="3">初级工程师</option>
                    <option value="4">中级工程师</option> 
                  </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">视频海报</label>
    <div class="col-sm-10">
      <input type="file" name="pic" class="form-control" id="inputPassword" required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">视频简介</label>
    <div class="col-sm-10">
      <!-- <input type="text" name="sshcredit" class="form-control" id="inputPassword" required> -->
       <textarea class="form-control" name="intro" rows="3" required></textarea>
    </div>
  </div>
 
  <button type="submit" class="btn btn-primary">提交</button>
</form>
            </div>
           
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<script src="__STATIC__/assets/plugins/jquery/jquery.min.js"></script>
<script>
  $(function(){
    $("#know").change(function(){
      $.get("{:url('show')}",{know:$("#know").val()},function(data){
        $("#kboy").html(data);
      });
    });
  })
</script>


{/block}
{block name="main"}<div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-block">
                                <div class="card-body">
                                        <table class="table table-striped  mt-3">
                                            <thead>
                                                <tr>
                                                    <th scope="col"><p class="text-center">状态</p></th>
                                                    <th scope="col"><p class="text-center">序号</p></th>
                                                    <th scope="col"><p class="text-center">视频名称</p></th>
                                                    <th scope="col"><p class="text-center">视频类型</p></th>
                                                    <th scope="col"><p class="text-center">职业方向</p></th>
                                                    <th scope="col"><p class="text-center">视频海报</p></th>
                                                    <!-- <th style="width: 23%;" scope="col"><p class="text-center">视频简介</p></th> -->
                                                    <th scope="col"><p class="text-center">视频上传时间</p></th>
                                                    
                                                    <!-- <th scope="col"><p class="text-center">点击量</p></th> -->
                                                  
                                                    
                                                    <th scope="col"><p class="text-center">操作</p></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {volist name="videos" id="video" key="k"}
                                                <tr>
                                                    <td>
                                                        {if condition="$video.vstatus==0"}<p class="text-center text-success">正常</p>
                                                        {else/}<p class="text-center text-danger">封禁</p>
                                                        {/if}
                                                    </td>
                                                    <td><p class="text-center">{$k+($page-1)*10}</p></td>
                                                
                                                    <td><p class="text-center">{$video.videoname}</p></td>
                                                    
                                                    <td><p class="text-center">{$video.typename}</p></td>
                                                     <td><p class="text-center">{$video.oname}</p></td>

                                                    <td class="text-center">
                                                        <img src="__STATIC__/videopic/{$video.pic}" width="100px" height="70px" >
                                                    </td>
                                                   
                                                     <td><p class="text-center">{$video.uploaddate}</p></td>
                                                     
                                                     
                                                       
                                                        
                                                    <td class="text-center">
                                                        
                                                       <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
        <span class="glyphicon glyphicon-cog">Settings</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li>
            <a class="text-danger" href="{:url('shield',['vid'=>$video.vid])}"><i class="icon-ban"></i>&nbsp;解除/封禁</a>
        </li>

        <li>
           <a href="{:url('update',['vid'=>$video.vid])}" class="text-center"><i class="icon-pencil"></i>&nbsp;修改视频信息</a>
        </li>
        <li class="divider"></li>
        <li>
             <a href="{:url('videodetails',['vid'=>$video.vid])}" class="text-center"><i class="icon-info"></i>&nbsp;视频详情</a>
        </li>
        <!-- <li class="divider"></li>
        <li>
            <a href="#">分离的链接</a>
        </li> -->
    </ul>
</div>
                                                      </td>
                                                    <td>
                                                </td>
                                                </tr>
                                                {/volist}
                                                
                                                
                                            </tbody>
                                        </table>
                                       {$videos->render()}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>{/block}